﻿#if NETCore
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;

namespace Longbow.Web.Controller
{
    [Route("api/[controller]")]
    [ApiController]
    [AllowAnonymous]
    public class ErrorController : ControllerBase
    {
        [HttpGet]
        public ActionResult<string> Get()
        {
            return "Error";
        }

        [HttpPost]
        public ActionResult<string> Post()
        {
            HttpContext.Connection.RemoteIpAddress = System.Net.IPAddress.Parse("192.168.100.102");
            throw new Exception("Unit Test");
        }
    }

    [Route("[controller]/[action]")]
    [ApiController]
    public class ExFilterController : ControllerBase
    {
        [HttpGet]
        public ActionResult<string> ThrowException()
        {
            HttpContext.Connection.RemoteIpAddress = System.Net.IPAddress.Parse("192.168.100.102");
            throw new Exception("Unit Test");
        }
    }
}
#endif